package com.hiultra.archive.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hiultra.common.annotation.Log;
import com.hiultra.common.core.controller.BaseController;
import com.hiultra.common.core.domain.AjaxResult;
import com.hiultra.common.enums.BusinessType;
import com.hiultra.archive.domain.ArchiveBoxinnerMove;
import com.hiultra.archive.service.IArchiveBoxinnerMoveService;
import com.hiultra.common.utils.poi.ExcelUtil;
import com.hiultra.common.core.page.TableDataInfo;

/**
 * 盒间档案移位详情Controller
 *
 * @author 派大星
 * @date 2024-07-23
 */
@RestController
@RequestMapping("/archive/ArchiveBoxinnerMove")
public class ArchiveBoxinnerMoveController extends BaseController
{
    @Autowired
    private IArchiveBoxinnerMoveService archiveBoxinnerMoveService;

    /**
     * 查询盒间移位详情列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMove:list')")
    @GetMapping("/list")
    public TableDataInfo list(ArchiveBoxinnerMove archiveBoxinnerMove)
    {
        startPage();
        List<ArchiveBoxinnerMove> list = archiveBoxinnerMoveService.selectArchiveBoxinnerMoveList(archiveBoxinnerMove);
        return getDataTable(list);
    }

    /**
     * 导出盒间移位详情列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMove:export')")
    @Log(title = "盒间移位详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ArchiveBoxinnerMove archiveBoxinnerMove)
    {
        List<ArchiveBoxinnerMove> list = archiveBoxinnerMoveService.selectArchiveBoxinnerMoveList(archiveBoxinnerMove);
        ExcelUtil<ArchiveBoxinnerMove> util = new ExcelUtil<ArchiveBoxinnerMove>(ArchiveBoxinnerMove.class);
        util.exportExcel(response, list, "盒间移位详情数据");
    }

    /**
     * 获取盒间移位详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMove:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(archiveBoxinnerMoveService.selectArchiveBoxinnerMoveById(id));
    }

    /**
     * 新增盒间移位详情
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMove:add')")
    @Log(title = "盒间移位详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ArchiveBoxinnerMove archiveBoxinnerMove)
    {
        return toAjax(archiveBoxinnerMoveService.insertArchiveBoxinnerMove(archiveBoxinnerMove));
    }

    /**
     * 修改盒间移位详情
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMove:edit')")
    @Log(title = "盒间移位详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ArchiveBoxinnerMove archiveBoxinnerMove)
    {
        return toAjax(archiveBoxinnerMoveService.updateArchiveBoxinnerMove(archiveBoxinnerMove));
    }

    /**
     * 删除盒间移位详情
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMove:remove')")
    @Log(title = "盒间移位详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(archiveBoxinnerMoveService.deleteArchiveBoxinnerMoveByIds(ids));
    }
    /**
     * 根据任务id查询盒移位信息详情
     * @param taskId
     * @return
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMove:edit')")
    @GetMapping(value = "/selectArchiveBoxinnerMoveByTaskId/{taskId}")
    public AjaxResult selectArchiveBoxinnerMoveByTaskId(@PathVariable("taskId") String taskId)
    {
        return AjaxResult.success(archiveBoxinnerMoveService.selectArchiveBoxinnerMoveByTaskId(taskId));
    }

    /**
     * 批量修改修改盒移位
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveBoxinnerMove:editarchiveBoxinnerMovekList')")
    @Log(title = "批量修改修改盒间移位", businessType = BusinessType.UPDATE)
    @PostMapping("/editarchiveBoxinnerMovekList")
    public AjaxResult editarchiveBoxinnerMovekList(@RequestBody List<ArchiveBoxinnerMove> archiveBoxinnerMoveList)
    {
        return archiveBoxinnerMoveService.updateArchiveBoxMoveList(archiveBoxinnerMoveList,getUsername());
    }
}
